package com.example.post_process;

import com.example.mapper_practice.MapperInterface;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

@Component
public class MyBeanFactoryPostProcess implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
//        GenericBeanDefinition beanDefinition = (GenericBeanDefinition) beanFactory.getBeanDefinition("h");
//        System.out.println("beanDefinition.getAutowireMode()  ==   " + beanDefinition.getAutowireMode());

        GenericBeanDefinition beanDefinition = (GenericBeanDefinition) beanFactory.getBeanDefinition(MapperInterface.class.getSimpleName());
        String beanClassName = beanDefinition.getBeanClassName();
        System.out.println("beanDefinition.getAutowireMode()  ==   " + beanDefinition.getAutowireMode());
    }
}
